package com.woniu.cq.medical.service.impl;

import com.woniu.cq.medical.dao.mymapper.My_CaseChangeInfoMapper;
import com.woniu.cq.medical.entity.CaseChangeInfo;
import com.woniu.cq.medical.dao.CaseChangeInfoMapper;
import com.woniu.cq.medical.service.CaseChangeInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Lucas
 * @since 2020-09-09
 */
@Service
public class CaseChangeInfoServiceImpl extends ServiceImpl<CaseChangeInfoMapper, CaseChangeInfo> implements CaseChangeInfoService {
    @Autowired
    private My_CaseChangeInfoMapper myCaseChangeInfoMapper;

    /**
     * 根据身份证和病历号查询病人的病例修改记录   如果caseID为空的字符串  则只使用  idCard 作为条件查询
     * @param idCard
     * @return
     */
    @Override
    public List<CaseChangeInfo> selectCaseChangeInfoByIdCard(String idCard, String caseID) {
        if (caseID.equals("")){
            List<CaseChangeInfo> caseChangeInfos = myCaseChangeInfoMapper.selectCaseChangeInfoByIdCard(idCard);
            return caseChangeInfos;
        }
        List<CaseChangeInfo> caseChangeInfos = myCaseChangeInfoMapper.selectPatientByIdCardAndCaseId(idCard, caseID);
        return caseChangeInfos;
    }


}
